package com.unknowpupil.design.observer;

/**
 * @Description: <p>
 *
 * </p>
 * @Author: <a> w10g </a>
 * @CreateDate: Create in 2020/4/28 16:32
 * @Classname: ObserverA
 * @Version: 1.0
 */
public class ObserverA implements Observer {
    /**
     * 需要跟目标对象的state值保持一致。
     */
    private int myState;

    public int getMyState() {
        return myState;
    }

    public void setMyState(int myState) {
        this.myState = myState;
    }

    @Override
    public void update(Subject subject) {
        myState = ((ConcreteSubject)subject).getState();
    }
}
